
cd "/Users/ecconnors/OneDrive - University of South Carolina/Research/Projects/Values/Paper/POBE Final"

******************************************************************************
* Qualtrics Value Ownership Study (N=1,710)
******************************************************************************

*load data
use "Qualtrics.dta", clear

*who owns which value?
*equal opportunity
tab equality
ttest equality == 0
*moral traditionalism
tab morality
ttest morality == 0 
*self-reliance
tab selfreliance
ttest selfreliance == 0

*keep only pure and leaning independents (N=511)
keep if party == 3
count
*equal opportunity
tab equality
ttest equality == 0
*moral traditionalism
tab morality
ttest morality == 0 
*self-reliance
tab selfreliance
ttest selfreliance == 0

*keep only pure independents (N=246)
keep if strength == 0
count
*equal opportunity
tab equality
ttest equality == 0
*moral traditionalism
tab morality
ttest morality == 0 
*self-reliance
tab selfreliance
ttest selfreliance == 0

******************************************************************************
* Amazon's Mechanical Turk Value Ownership Study (N=152)
******************************************************************************

*load data
use "Mturk.dta", clear

*equality
tab newequality
ttest newequality == 0
*moral tolerance
tab moraltolerance
ttest moraltolerance == 0
*freedom
tab freedom
ttest freedom == 0
*economic security
tab economicsecurity
ttest economicsecurity == 0
*social order
tab socialorder
ttest socialorder == 0
*individualism
tab individualism
ttest individualism == 0
*limited government
tab limitedgovernment
ttest limitedgovernment == 0
*patriotism
tab patriotism
ttest patriotism == 0
*self-reliance
tab selfreliance
ttest selfreliance == 0
*moral traditionalism
tab moraltraditionalism
ttest moraltraditionalism == 0

*keep only pure and leaning independents (N=45)
keep if partisanship == 3 | partisanship == 4 | partisanship == 5
count
*equality
tab newequality
ttest newequality == 0
*moral tolerance
tab moraltolerance
ttest moraltolerance == 0
*freedom
tab freedom
ttest freedom == 0
*economic security
tab economicsecurity
ttest economicsecurity == 0
*social order
tab socialorder
ttest socialorder == 0
*individualism
tab individualism
ttest individualism == 0
*limited government
tab limitedgovernment
ttest limitedgovernment == 0
*patriotism
tab patriotism
ttest patriotism == 0
*self-reliance
tab selfreliance
ttest selfreliance == 0
*moral traditionalism
tab moraltraditionalism
ttest moraltraditionalism == 0

******************************************************************************
* Dynata Experiment 1 (N=998)
******************************************************************************

*load data
use "Dynata 1a.dta", clear

*is attrition (N=74) related to pre-treatment variables?
tab attrition
logit attrition democrat strength ib1.liberal extremity ib3.gender age ///
education interest

*load data
use "Dynata 1b.dta", clear

*Cronbach's alpha
alpha like competent qualified integrity service ///
representation leader, item

*factor analysis
factor like competent qualified integrity service ///
representation leader

*don't know (DK) responses
tab competent_DK
tab qualified_DK
tab integrity_DK
tab weak_DK
tab represent_DK
tab leader_DK
*summary DK variable 1: 1 if they say don't know ever (311)
tab dontknow
*summary DK variable 2: 1 if they always say don't know (104)
tab dontknow2

*mean favorability 
mean summary
*mean favorability by condition: 1=outparty trespass, 2=outparty owned, 
*3=inparty trespass, 4=inparty owned
mean summary if treatment == 1
mean summary if treatment == 2
mean summary if treatment == 3
mean summary if treatment == 4

*expectancy violation hypothesis
*(compare trespassed to owned (1=trespassed, 0=owned)
ttest summary, by(trespass)

*polarization hypothesis
*compare inparty to outparty politicians (1=inparty, 0=outparty)
ttest summary, by(inparty)
*compare out-party trespassing candidate to in-party trespassing candidate
*(1=inparty trespassing, 0=outparty trespassing)
ttest summary, by(inparty_outparty_trespassing)

*differential effects hypothesis
*compare trespassed to owned value with inparty candidates (1=trespassed,
*0=owned)
ttest summary, by(trespass2)
*compare trespassed to owned value with outparty candidates (1=trespassed,
*0=owned)
ttest summary, by(trespass1)

*ols regression predicting favorability by inparty*trespassed 
reg summary i.inparty##i.trespass, robust
*robustness check: separate dependent variable measures
reg like i.inparty##i.trespass, robust
reg competent i.inparty##i.trespass, robust
reg qualified i.inparty##i.trespass, robust
reg integrity i.inparty##i.trespass, robust
reg service i.inparty##i.trespass, robust
reg representation i.inparty##i.trespass, robust
reg leader i.inparty##i.trespass, robust

*moderators and alternative explanation
*post-treatment bias analyses
*do people endorse values more if inparty endorses them? no
reg equality_endorse inparty
reg reliance_endorse inparty
*does affective polarization differ by condition? no
tab affective_polarization treatment, chi2
*full interaction model (party-congruent value endorsements, 
*affective polarization, party-congruent ideological extremity)
mi set flong 
mi register imputed age interest
mi impute mvn age interest, add(5)
mi estimate, saving(myresults, replace) esample(esample1): reg summary ///
i.inparty##i.trespass##c.values ///
i.inparty##i.trespass##c.affective_polarization ///
i.inparty##i.trespass##c.ideological_extremity democrat ///
strength ib1.liberal interest age ib3.gender education i.ethnicity, ///
robust coeflegend
*compare party-congruent value endorsement and affective polarization 
*coefficients
mi estimate (diff: _b[1.inparty#1.trespass#c.affective_polarization]- ///
_b[1.inparty#1.trespass#c.values]) using myresults
*marginal effects
mi estimate: reg summary ///
i.inparty##i.trespass##c.values ///
i.inparty##i.trespass##c.affective_polarization ///
i.inparty##i.trespass##c.ideological_extremity democrat ///
strength ib1.liberal interest age ib3.gender education i.ethnicity, ///
robust coeflegend
*by party-congruent value endorsements
mimrgns using myresults, esample(esample1) at(values=(0(.1)1) ///
inparty=(0 1) trespass=(0 1)) 
*by affective polarization
mimrgns using myresults, esample(esample1) ///
at(affective_polarization=(0(.1)1) inparty=(0 1) trespass=(0 1)) 
*by party-congruent ideological extremity
mimrgns using myresults, esample(esample1) ///
at(ideological_extremity=(0(.1)1) inparty=(0 1) trespass=(0 1)) 
*is the party-congruent ideological extremity interaction significant 
*without the other two interactions?
mi estimate, saving(myresults, replace) esample(esample2): reg summary ///
i.inparty##i.trespass##c.ideological_extremity democrat ///
strength ib1.liberal interest age ib3.gender education i.ethnicity, ///
robust coeflegend

******************************************************************************
* Dynata Experiment 2 (N=839)
******************************************************************************

*load data
use "Dynata 2.dta", clear

*Cronbach's alpha
alpha like competent qualified integrity service ///
representation leader, item

*factor analysis
factor like competent qualified integrity service ///
representation leader

*don't know (DK) responses
tab competent_DK
tab qualified_DK
tab integrity_DK
tab representation_DK
tab leader_DK
*summary DK variable 1: 1 if they say don't know ever (273)
tab dontknow
*summary DK variable 2: 1 if they always say don't know (84)
tab dontknow2

*mean favorability 
mean summary
*mean favorability by condition: 1=outparty trespass, 2=outparty owned, 
*3=inparty trespass, 4=inparty owned
mean summary if treatment == 1
mean summary if treatment == 2
mean summary if treatment == 3
mean summary if treatment == 4

*expectancy violation hypothesis
*(compare trespassed to owned (1=trespassed, 0=owned)
ttest summary, by(trespass)

*polarization hypothesis
*compare inparty to outparty politicians (1=inparty, 0=outparty)
ttest summary, by(inparty)
*compare out-party trespassing candidate to in-party trespassing candidate
*(1=inparty trespassing, 0=outparty trespassing)
ttest summary, by(inparty_outparty_trespassing)

*differential effects hypothesis
*compare trespassed to owned value with inparty candidates (1=trespassed,
*0=owned)
ttest summary, by(trespass1)
*compare trespassed to owned value with outparty candidates (1=trespassed,
*0=owned)
ttest summary, by(trespass2)

*ols regression predicting favorability by inparty*trespassed 
reg summary i.inparty##i.trespass, robust
*robustness check: separate dependent variable measures
reg like i.inparty##i.trespass, robust
reg competent i.inparty##i.trespass, robust
reg qualified i.inparty##i.trespass, robust
reg integrity i.inparty##i.trespass, robust
reg service i.inparty##i.trespass, robust
reg representation i.inparty##i.trespass, robust
reg leader i.inparty##i.trespass, robust

*moderators and alternative explanation
*post-treatment bias analyses
*does affective polarization differ by condition? no
tab affective_polarization treatment, chi2
*full interaction model (affective polarization, party-congruent 
*ideological extremity)
mi set flong 
mi register imputed age
mi impute mvn age, add(5)
mi estimate, saving(myresults, replace) esample(esample1): reg summary ///
i.inparty##i.trespass##c.affective_polarization ///
i.inparty##i.trespass##c.ideological_extremity democrat ///
strength ib1.liberal interest age ib3.gender education white, ///
robust coeflegend
*marginal effects
mi estimate: reg summary ///
i.inparty##i.trespass##c.affective_polarization ///
i.inparty##i.trespass##c.ideological_extremity democrat ///
strength ib1.liberal interest age ib3.gender education white, ///
robust coeflegend
*by affective polarization
mimrgns using myresults, esample(esample1) ///
at(affective_polarization=(0(.1)1) inparty=(0 1) trespass=(0 1)) 
*by party-congruent ideological extremity
mimrgns using myresults, esample(esample1) ///
at(ideological_extremity=(0(.1)1) inparty=(0 1) trespass=(0 1)) 
*is the party-congruent ideological extremity interaction significant 
*without the other interaction?
mi estimate, saving(myresults, replace) esample(esample2): reg summary ///
i.inparty##i.trespass##c.ideological_extremity democrat ///
strength ib1.liberal interest age ib3.gender education white, ///
robust coeflegend






